<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // for循环语句
    // 打印5 个星号
    // for (var x = 0; x < 5; x++) {
    //   document.write("*")
    // }

    // 打印 5行5列的 *
    for (var i = 0; i < 5; i++) {

      for (var y = 0; y < 5; y++) {  //*****
        document.write("*")
      }
      document.write("<br/>")
    }
    // 求1-100的和
    var sum = 0;
    for (var k = 1; k <= 100; k++) {
      sum += k;
    }
    console.log(sum)
    // 求1--100的偶数和
    var even = 0;
    var odd = 0;
    // for (var h = 1; h <= 100; h++) {
    //   if (h % 2 == 0) {
    //     even =even+ h;
    //   } else {
    //     odd += h;
    //   }
    // }
    // console.log("偶数和：" + even)
    // console.log("奇数和：" + odd)

    var f = 1;
    while (f <= 100) {
      if (f % 2 == 0) {
        even += f;
      } else {
        odd += f;
      }
      f++;
    }
    console.log("偶数和：" + even)
    console.log("奇数和：" + odd)
    // for循环循环数组
    var arr = ["王一博", "肖战", "罗志祥", "小沈阳", "王一烦"]
    //每个数组都有length属性  还有下标的特性  下标从0开始  
    for (var d = 0; d < arr.length; d++) {
      document.write(arr[d] + "<br/>")
    }



  </script>
</body>

</html>